﻿using CoffeeShop.Models.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CoffeeShop.DAO
{
    public class UnitDao
    {
        private CFMSEntities _entities = new CFMSEntities();

        /// <summary>
        /// Get all units in DB
        /// </summary>
        /// <returns></returns>
        public List<Unit> GetListUnits()
        {
            try
            {
                var resultQuery = from unit in _entities.Units
                                   where unit.IsDeleted == false
                                   select unit;
                return resultQuery.ToList();
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Message);
                return null;
            }   
        }
    }
}